import axios from 'axios'
// import { getToken } from '@/helpers/token'

// const domain = process.env.NODE_ENV === 'production' ? 'http://workflow-dinghao.test.nj/dinghao' : '/api'
const domain = process.env.NODE_ENV === 'production' ? '' : '/api'

const getURL = (path) => {
  return `${domain}${path}`
}

// export const getHeaders = () => {
//   return {
//     Authorization: `Bearer ${getToken()}`,
//   }
// }

export const post = (url, data = {}) => {
  return axios.post(getURL(url), data)
}

export const del = (url, data = {}) => {
  return axios.delete(getURL(url), data)
}

export const get = (url, data = {}) => {
  return axios.get(getURL(url), {
    params: data,
  })
}
